<!--
 * @Author: 陈德基
 * @Date: 2023-12-17 04:19:01
 * @LastEditTime: 2023-12-17 04:39:14
 * @Description: 
 * @FilePath: /fullstack/react/demo/demo05/clearfix.html
 * 联系方式：
 * wx: melody_2009
 * qq: 7815171323 
-->


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">

  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    .top {
      margin: 0px auto;
      width: 1000px;
      /* height: 300px; */
      background-color: pink;
    }

    .bottom {
      width: 100%;
      height: 100px;
      background-color: red;
    }

    .left {
      float: left;
      width: 200px;
      height: 300px;
      background-color: green;
    }

    .right {
      float: right;
      width: 800px;
      height: 300px;
      background-color: blue;
    }

    /* 单伪元素写法 */
    /* 清除浮动 + 伪元素 */
    /* .clearfix::after { */
      /* 伪元素 必须搭配 content 属性 */
      /* content: ""; */
      /* display: block; */
      /* clear: both; */
    /* } */

    /* 双伪元素写法 */
    /* .clearfix::before, .clearfix::after { */
      /* content: ""; */
      /* display: table; */
    /* } */
    /* .clearfix::after { */
      /* clear: both; */
    /* } */

    /* overflow: hidden;  父元素计算自身高度，解决浮动 */
    .clearfix {
      overflow: hidden;
    }

  </style>

</head>

<body>

  <div class="top clearfix">
    <div class="left"></div>
    <div class="right"></div>
  </div>
  <div class="bottom"></div>

</body>